package com.example.data.factory.web1.controller;

import com.example.data.factory.common.Dto.DeletClassaifyDto;
import com.example.data.factory.common.Dto.InsertClassifyDto;
import com.example.data.factory.common.Dto.SearchClassifyDto;
import com.example.data.factory.common.result.R;
import com.example.data.factory.entity.entity.Classify;
import com.example.data.factory.service.service.ClassifyService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lhy
 * @since 2025-03-03
 */
@RestController
@RequestMapping("/classify")
public class ClassifyController {
    @Resource
    private ClassifyService classifyService;

    @GetMapping("/SearchClassify")

    public R<List<Classify>> SearchClassify(@Valid SearchClassifyDto searchClassifyDto) {
        return classifyService.search ( searchClassifyDto );
    }

    @PostMapping("/InsertClassify")
    public R<Classify> InsertClassify(@RequestBody InsertClassifyDto insertClassifyDto, HttpServletRequest request) {
        return classifyService.inserts ( insertClassifyDto, request );
    }

    @DeleteMapping("/DeleteClassify")
    public R<Classify> DeleteClassify(DeletClassaifyDto deletClassaifyDto) {
        return classifyService.delete ( deletClassaifyDto );
    }
}
